package com.igoal.dto;

import com.igoal.entity.City;
import com.igoal.entity.Company;
import com.igoal.utils.SynchronizeAttributeWithOther;
import com.igoal.utils.SynchronizeDirection;

public class CompanyDTO extends BaseDTO<Company> {

	private String name;
	private String field;
	private String title;
	private String cityName;
	private Integer fromYear;
	private Integer toYear;
	private Long cityId;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getField() {
		return field;
	}

	public void setField(String field) {
		this.field = field;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public Long getCityId() {
		return cityId;
	}

	public void setCityId(Long cityId) {
		this.cityId = cityId;
	}

	public Integer getFromYear() {
		return fromYear;
	}

	public void setFromYear(Integer fromYear) {
		this.fromYear = fromYear;
	}

	public Integer getToYear() {
		return toYear;
	}

	public void setToYear(Integer toYear) {
		this.toYear = toYear;
	}

	@SynchronizeAttributeWithOther(direction = SynchronizeDirection.FROM, value = "city")
	public void initCity(Object entity) {
		if (entity != null) {
			City city = (City) entity;
			cityName = city.getCityName();
			cityId = city.getId();
		}
	}
}
